using System.Collections;
using UnityEngine;

public class BubbleWildcardInfo : GenericDialog
{
	private bool respondsToTouch;

	private void OnEnable()
	{
		if (Globals.appState != 0 && Globals.appState != AppState.unknown)
		{
			respondsToTouch = false;
			StartCoroutine(RespondToTouchLater());
		}
	}

	private void OnDisable()
	{
		if (Globals.appState != 0 && Globals.appState != AppState.unknown)
		{
			StopAllCoroutines();
			if (respondsToTouch)
			{
				EventManager.OneTouchBeginEvent -= OnTouchBegin;
			}
		}
	}

	private void OnTouchBegin(Vector3 touchPosition)
	{
		FadeOut();
	}

	private IEnumerator RespondToTouchLater()
	{
		float starTime = Time.realtimeSinceStartup;
		while (Time.realtimeSinceStartup - starTime < 0.2f)
		{
			yield return null;
		}
		EventManager.OneTouchBeginEvent += OnTouchBegin;
		respondsToTouch = true;
	}
}
